package com.wangzhixuan.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.wangzhixuan.commons.result.PageInfo;
import com.wangzhixuan.mapper.TDatadicMapper;
import com.wangzhixuan.model.TDatadic;
import com.wangzhixuan.service.ITDatadicService;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author thomas_liu
 * @since 2018-07-21
 */
@Service
public class TDatadicServiceImpl extends ServiceImpl<TDatadicMapper, TDatadic> implements ITDatadicService {
	
	@Autowired
	private TDatadicMapper datadicMapper;
	
	@Override
	public void selectDataGrid(PageInfo pageInfo) {
		Page<Map<String, Object>> page = new Page<Map<String, Object>>(pageInfo.getNowpage(), pageInfo.getSize());
		page.setOrderByField(pageInfo.getSort());
		page.setAsc(pageInfo.getOrder().equalsIgnoreCase("asc"));
		List<Map<String, Object>> list = datadicMapper.selectDatadicPage(page, pageInfo.getCondition());
		pageInfo.setRows(list);
		pageInfo.setTotal(page.getTotal());
	}
	
}
